package com.hefei.garden.service.impl;

import com.hefei.garden.config.NocasDynamicConfigData;
import com.hefei.garden.mapper.dataSource2.TestDataSourceMapper;
import com.hefei.garden.mapper.primary.TestPrimerMapper;
import com.hefei.garden.service.TestService;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author: devil
 * @Date: 2022/7/3 19
 * @Description:
 */
@Service
@RefreshScope
public class TestServiceImpl implements TestService {

    @Resource
    private TestDataSourceMapper testDataSourceMapper;

    @Resource
    private TestPrimerMapper testPrimerMapper;

    @Resource
    private NocasDynamicConfigData nocasDynamicConfigData;

    @Override
    public String getTestInfo(String type) {
        String result;
        if ("1".equals(type)) {
            result = testPrimerMapper.getTestInfo();
        } else {
            result = testDataSourceMapper.getTestInfo();
        }

        System.out.println(nocasDynamicConfigData.USER_ADDRESS);
        return result;
    }
}
